package com.norns.torque.entrty;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;

import java.time.LocalDateTime;
import java.util.List;

@Dao
public interface ScaleDao {
    @Query("SELECT * FROM Scale")
    List<ScaleBean> getAll();

    @Query("SELECT * FROM Scale WHERE data > (:minDate)")
    List<ScaleBean> loadAllByIdsHistory(LocalDateTime minDate);

    @Insert
    void insert(ScaleBean scale);

    @Delete
    void delete(ScaleBean scale);

    @Query("DELETE FROM Scale")
    void deleteAll();

    @Query("SELECT MAX(uid) FROM Scale")
    Integer getMaxId();

    @Query("SELECT COUNT(uid) FROM Scale")
    Integer getCount();
}
